import java.util.Scanner;
public class Test4 {
    public static int sum(int n){
        if(n<10){
            return n;
        }return n%10+sum(n/10);
    }

    public static void main(String[] args) {
        Scanner sca=new Scanner(System.in);
        System.out.println("请输入一个数字");
        int a=sca.nextInt();
        int temp=sum(a);
        System.out.println(temp);
    }
}
